<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS 浮动</title>
    <style>
        .father {
            background-color: aquamarine;
            /* height: 150px; */
            border: 3px solid brown;
            /* overflow: hidden; */
            /* 清除浮动 */
        }

        /* 伪元素清除浮动 */
        .father::after {
            content: "";
            display: block;
            clear: both;
        }

        .left-son {
            width: 100px;
            height: 100px;
            background-color: lightcoral;
            float: left;
        }

        .right-son {
            width: 100px;
            height: 100px;
            background-color: lightblue;
            float: right;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="left-son">左浮动</div>
        <div class="right-son">右浮动</div>
    </div>
    <p>这是一段文本</p>
</body>

</html>